package com.hackintosh.oa;

import java.util.ArrayList;
import java.util.List;

/**
 * @description：具体公司
 * @author：twislyn
 * @date：Created in 2021/05/15
 * @modified By：
 * @version: 1.0
 */
public class ConcreteCompany extends Company {
    private List<Company> companyList = new ArrayList<>();

    public ConcreteCompany(String name) {
        super(name);
    }

    @Override
    public void add(Company company) {
        companyList.add(company);
    }

    @Override
    public void display(int depth) {
        System.out.println(this.creatString('-', depth) + this.name);
        for (Company company : companyList) {
            company.display(depth + 2);
        }
    }

    @Override
    public void lineOfDuty() {
        for (Company company : companyList) {
            company.lineOfDuty();
        }
    }
}
